package edu.istu.asu07_1.live.gui;

import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.Toolkit;

import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JLabel;

public class SplashForm extends JFrame{

	private ImageIcon splashImage;

	public SplashForm() {
		setLocationOnScreenCenter();
		init();
	}

	private void init(){
		setSplashImage();

		setTitle("Starting artificial live");
		setUndecorated(true);
		setVisible(true);
		setSize(DEFAULT_WIDTH, DEFAULT_HEIGHT);
	}

	private void setSplashImage(){
		splashImage = new ImageIcon("./img/splash.png");
		JLabel splashLabel = new JLabel(splashImage);
		add(splashLabel, BorderLayout.CENTER);
	}

	private void setLocationOnScreenCenter(){
		Toolkit toolkit = Toolkit.getDefaultToolkit();
		Dimension screenSize = toolkit.getScreenSize();
		setLocation((screenSize.width/2)-DEFAULT_WIDTH/2, (screenSize.height/2)-DEFAULT_HEIGHT/2);
	}


	public static final int DEFAULT_WIDTH = 300;
	public static final int DEFAULT_HEIGHT = 200;
}
